package com.gitee.wsl.mathematics.algebraic.number

import com.gitee.wsl.mathematics.algebraic.GroupOps

/**
 * A combination of [NumericAlgebra] and [Ring] that adds intrinsic simple operations on numbers like `T+1`
 * TODO to be removed and replaced by extensions after multiple receivers are there
 */
 interface NumbersAddOps<T> : GroupOps<T>, NumericAlgebra<T> {
    /**
     * Addition of element and scalar.
     *
     * @receiver the augend.
     * @param other the addend.
     */
     operator fun T.plus(other: Number): T = this + number(other)

    /**
     * Addition of scalar and element.
     *
     * @receiver the augend.
     * @param other the addend.
     */
     operator fun Number.plus(other: T): T = other + this

    /**
     * Subtraction of element from number.
     *
     * @receiver the minuend.
     * @param other the subtrahend.
     * @receiver the difference.
     */
     operator fun T.minus(other: Number): T = this - number(other)

    /**
     * Subtraction of number from the element.
     *
     * @receiver the minuend.
     * @param other the subtrahend.
     * @receiver the difference.
     */
     operator fun Number.minus(other: T): T = -other + this
}